package com.yoo.ons.function.like

import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.yoo.ons.base.BaseVMListFragment
import com.yoo.ons.base.adpater.BaseRecyclerAdapter
import com.yoo.ons.databinding.FragmentDashboardBinding
import com.yoo.ons.function.like.adapter.MyAdapter
import com.yoo.ons.function.like.viewmodel.WhoLikeMeViewModel
import com.scwang.smart.refresh.layout.SmartRefreshLayout

class DashboardFragment : BaseVMListFragment<String, FragmentDashboardBinding, WhoLikeMeViewModel>(
    FragmentDashboardBinding::inflate,
    WhoLikeMeViewModel::class.java
) {
    override fun getMyAdapter(): BaseRecyclerAdapter<String, *> {
        return MyAdapter()
    }
    override fun getSmartRefreshLayout(): SmartRefreshLayout? {
        return binding?.refreshLayout
    }

    override fun getRecyclerView(): RecyclerView? {
        return binding?.recyclerView
    }

    override fun getLayoutManager(): RecyclerView.LayoutManager {
        return LinearLayoutManager(activity)
    }

    override fun isCanLoadMore(): Boolean {
        return false
    }

    override fun initData() {
        onRefresh()

    }
    override fun onRefresh() {
        loadData(getData())
    }

    override fun onLoadMore() {
        loadData(getData())
    }

    fun getData(): ArrayList<String> {
        val items = ArrayList<String>()
        for (i in 0..20) {
            items.add(i.toString())
        }
        return items
    }
}